package com.hsh.vo.result.convert;

import com.hsh.persist.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;


@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
public class DbMenuListVO extends BaseEntity implements Serializable {


    @ApiModelProperty(value = "pk 菜单id")
    private String menuId;
    @ApiModelProperty(value = "父菜单id，一级菜单为0")
    private Integer parentId;

    @ApiModelProperty(value = "菜单名称")
    private String menuName;

    @ApiModelProperty(value = "菜单地址【唯一】")
    private String url;

    @ApiModelProperty(value = "权限标识（user：add，user：import）【唯一】")
    private String perms;

    @ApiModelProperty(value = "图标(默认旗帜)")
    private String icon;

    @ApiModelProperty(value = "类型 0菜单 1按钮(默认是菜单)")
    private Integer type;

    @ApiModelProperty(value = "排序")
    private Integer seq;

    @ApiModelProperty(value = "禁用：1，未禁：0")
    private Integer disabled;

    @ApiModelProperty(value = "菜单栏：0：不展开 1：展开")
    private Integer open;

    private List<DbMenuListVO> children = Collections.emptyList();

    public static Comparator<DbMenuListVO> order() {
        return Comparator.comparingInt(DbMenuListVO::getSeq);
    }
}
